package kr.saeildamil.androidstudty.ch06;

import kr.saeildamil.androidstudty.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

public class MultiPageEx extends Activity {
	View mPage1;
	View mPage2;
	View mPage3;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.multipage);
		
		mPage1 = findViewById(R.id.multipage_page1);
		mPage2 = findViewById(R.id.multipage_page2);
		mPage3 = findViewById(R.id.multipage_page3);
		
		findViewById(R.id.multipage_btn1).setOnClickListener(mClickListener);
		findViewById(R.id.multipage_btn2).setOnClickListener(mClickListener);
		findViewById(R.id.multipage_btn3).setOnClickListener(mClickListener);
	}
	
	OnClickListener mClickListener = new OnClickListener() {
		public void onClick(View v) {
			mPage1.setVisibility(View.INVISIBLE);
			mPage2.setVisibility(View.INVISIBLE);
			mPage3.setVisibility(View.INVISIBLE);
			
			switch (v.getId()) {
			case R.id.multipage_btn1:
				mPage1.setVisibility(View.VISIBLE);
				break;
			case R.id.multipage_btn2:
				mPage2.setVisibility(View.VISIBLE);
				break;
			case R.id.multipage_btn3:
				mPage3.setVisibility(View.VISIBLE);
				break;
			}
		}
	};
}










